package main

import (
	"log"
	"net/http"
	_ "net/http/pprof"
	"time"
)

// 参考:https://segmentfault.com/a/1190000016412013
// 启用后访问：http://127.0.0.1:6060/debug/pprof/
// 终端：go tool pprof http://127.0.0.1:6060/debug/pprof/profile?seconds=60
// 终端：go tool pprof http://localhost:6060/debug/pprof/heap
// 终端：go tool pprof http://localhost:6060/debug/pprof/block
// 终端：go tool pprof http://localhost:6060/debug/pprof/mutex
// 终端：pprof -http=:8080 http://localhost:6060/debug/pprof/heap\?seconds\=60

func main() {
	go func() {
		for {
			log.Println(Add("https://github.com/EDDYCJY"))
			time.Sleep(time.Second * 2)
		}
	}()

	http.ListenAndServe("0.0.0.0:6060", nil)
}

var datas []string

func Add(str string) string {
	data := []byte(str)
	sData := string(data)
	datas = append(datas, sData)

	return sData
}
